package com.mjf.io.transformation;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

/**
 * 转换流：
 *  -OutputStreamWriter:将字节流以指定编码转换为字符流(写出数据到指定编码的文件)
 */
public class OutputStreamWriterUse {
    public static void main(String[] args) throws IOException {

        String filePath = "D:\\coding\\idea\\java-stu\\output\\hello_gbk.txt";

        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(filePath), "gbk");
        BufferedWriter bw = new BufferedWriter(osw);

        bw.write("hello 你好啊");

        bw.close();

    }
}
